{% extends '::base.html.twig' %}
{% block title %}Survey{% endblock %}
{% block body %}{%block content %}
        
    <h1>Lista ankiet</h1>

    <table class="records_list table table-striped table-hover">
        <thead>
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Produkty</th>
                <th>Zaproszeni</th>
                <th>Pary</th>
                <th>Createdat</th>
                <th>Updatedat</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
        {% for entity in entities %}
            <tr>
                <td><a href="{{ path('survey_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
                <td>{{ entity.name }}</td>
                <td>
                    {{entity.products|length}}:<br />
                    {% for product in entity.products %}
                        {{product.name}}<br />
                    {%endfor%}
                    <br />
                </td>
                <td>
                    {{entity.invitations|length}}<br />
                    
                    <br />
                </td>
                <td>{{entity.pairs}}</td>
                <td>{% if entity.createdAt %}{{ entity.createdAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                <td>{% if entity.updatedAt %}{{ entity.updatedAt|date('Y-m-d H:i:s') }}{% endif %}</td>
                <td>
                <ul>
                    <li>
                        <a href="{{ path('survey_show', { 'id': entity.id }) }}">Pokaż</a>
                    </li>
                    <li>
                        <a href="{{ path('survey_edit', { 'id': entity.id }) }}">Edytuj</a>
                    </li>
                </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

        <ul>
        <li>
            <a href="{{ path('survey_new') }}">
                Create a new entry
            </a>
        </li>
    </ul>
                {%endblock%}
    {% endblock %}
